import axios from "~/axios";

// 查询分类列表
export function tableList(categoryName) {
  return axios.get('/api/admin/upload/category/list', {
    params: {
      categoryName: categoryName
    }
  });
}

// 新增或修改
export function saveOrUpdate(formData) {
  let url = ''
  if(formData.id === 0) {
    url = 'save'
  } else {
    url = 'update'
  }
  return axios.post('/api/admin/upload/category/' + url, formData);
}

// 查询图片详情列表
export function tableDetailList(pageIndex, pageSize, params) {
  return axios.get('/api/admin/upload/detail/' + pageIndex + '/' + pageSize, {
    params: params
  });
}

// 移动图片到指定分类中
export function moveImgToCategory(formData) {
  return axios.post('/api/admin/upload/detail/moveImg', formData)
}

// 查询分类详情
export function categoryInfo(categoryId) {
  return axios.get('/api/admin/upload/category/info/' + categoryId);
}

// 删除分类
export function deleteCategory(id) {
  return axios.post('/api/admin/upload/category/remove/' + id)
}
